﻿/*----------------------------------------------------------------
//  <copyright file="IEntityUserStore.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2022-12-21 11:39</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.Authorization
{
    #region "定义实体用户信息存储"
    /// <summary>
    /// 定义实体用户信息存储
    /// </summary>
    public interface IEntityUserStore<TEntityUser, in TEntityUserInputDto, in TUserKey>
    {
        #region "属性"
        #region "获取 实体用户信息查询数据集"
        /// <summary>
        /// 获取 实体用户信息查询数据集
        /// </summary>
        IQueryable<TEntityUser> EntityUsers { get; }
        #endregion

        #endregion

        #region "方法"
        #region "检查实体用户信息是否存在"
        /// <summary>
        /// 检查实体用户信息是否存在
        /// </summary>
        /// <param name="predicate">检查谓语表达式</param>
        /// <param name="id">实体用户信息编号</param>
        /// <returns>实体用户信息是否存在</returns>
        Task<bool> CheckEntityUserExists(Expression<Func<TEntityUser, bool>> predicate, long id = default);
        #endregion
        #region "获取指定用户和实体的过滤条件组"
        /// <summary>
        /// 获取指定用户和实体的过滤条件组
        /// </summary>
        /// <param name="userId">用户编号</param>
        /// <param name="entityId">实体编号</param>
        /// <param name="operation">操作</param>
        /// <returns>过滤条件组</returns>
        FilterGroup[] GetEntityUserFilterGroups(TUserKey userId, long entityId, DataAuthOperation operation);
        #endregion
        #region "添加实体用户信息"
        /// <summary>
        /// 添加实体用户信息
        /// </summary>
        /// <param name="dtos">要添加的实体用户信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> CreateEntityUsers(params TEntityUserInputDto[] dtos);
        #endregion
        #region "更新实体用户信息"
        /// <summary>
        /// 更新实体用户信息
        /// </summary>
        /// <param name="dtos">包含更新信息的实体用户信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> UpdateEntityUsers(params TEntityUserInputDto[] dtos);
        #endregion
        #region "删除实体用户信息"
        /// <summary>
        /// 删除实体用户信息
        /// </summary>
        /// <param name="ids">要删除的实体用户信息编号</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> DeleteEntityUsers(params long[] ids);
        #endregion

        #endregion

    }
    #endregion

}
